package com.jz.netthings.bean.system;

import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.fasterxml.jackson.annotation.JsonIgnore;

import java.io.Serializable;
import java.util.List;

/**
 * <p>
 * 系统菜单资源表，包含了菜单和这个菜单下面的能访问的所有资源
 * </p>
 *
 * @author yyy
 * @since 2018-08-01
 */
@TableName(value = "jy_menu")
public class JyMenu implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    private String name;
    private String url;
    private String path;
    private String component;
    private Integer rank;
    @JsonIgnore
    @TableField("iconCls")
    private String iconCls;

    @JsonIgnore
    @TableField("keepAlive")
    private Integer keepAlive;

    @JsonIgnore
    @TableField("requireAuth")
    private String requireAuth;
    @TableField("parentId")
    private Integer parentId;
    private Integer enabled;

    /**
     * 资源类型（菜单/资源）
     * 1：菜单
     * 2：资源
     */
    @TableField("srcType")
    private Integer srcType;

    //用于菜单前端是否显示
    @TableField(exist = false)
    private Boolean menuShow = false;

    //是否是子集，用于前端显示
    @TableField(exist = false)
    private Boolean isChild = false;
    //
    @JsonIgnore
    @TableField(exist = false)
    private Boolean isEdit = false;
    //
    @JsonIgnore
    @TableField(exist = false)
    private Boolean  leaf = true;

    @JsonIgnore
    @TableField(exist = false)
    private List<JyRole> roles;

    @TableField(exist = false)
    private List<JyMenu> children;
//    private MenuMeta meta;


    public List<JyRole> getRoles() {
        return roles;
    }

    public void setRoles(List<JyRole> roles) {
        this.roles = roles;
    }

    public List<JyMenu> getChildren() {
        return children;
    }

    public void setChildren(List<JyMenu> children) {
        this.children = children;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getUrl() {
        return url;
    }

    public void setUrl(String url) {
        this.url = url;
    }

    public String getPath() {
        return path;
    }

    public void setPath(String path) {
        this.path = path;
    }

    public String getComponent() {
        return component;
    }

    public void setComponent(String component) {
        this.component = component;
    }

    public String getIconCls() {
        return iconCls;
    }

    public void setIconCls(String iconCls) {
        this.iconCls = iconCls;
    }

    public Integer getKeepAlive() {
        return keepAlive;
    }

    public void setKeepAlive(Integer keepAlive) {
        this.keepAlive = keepAlive;
    }

    public String getRequireAuth() {
        return requireAuth;
    }

    public void setRequireAuth(String requireAuth) {
        this.requireAuth = requireAuth;
    }

    public Integer getParentId() {
        return parentId;
    }

    public void setParentId(Integer parentId) {
        this.parentId = parentId;
    }

    public Integer getEnabled() {
        return enabled;
    }

    public void setEnabled(Integer enabled) {
        this.enabled = enabled;
    }

    public Boolean getMenuShow() {
        return menuShow;
    }

    public void setMenuShow(Boolean menuShow) {
        this.menuShow = menuShow;
    }

    public Boolean getLeaf() {
        return leaf;
    }

    public void setLeaf(Boolean leaf) {
        this.leaf = leaf;
    }

    public Boolean getEdit() {
        return isEdit;
    }

    public void setEdit(Boolean edit) {
        isEdit = edit;
    }

    public Integer getSrcType() {
        return srcType;
    }

    public void setSrcType(Integer srcType) {
        this.srcType = srcType;
    }

    public Boolean getChild() {
        return isChild;
    }

    public void setChild(Boolean child) {
        isChild = child;
    }

    public Integer getRank() {
        return rank;
    }

    public void setRank(Integer rank) {
        this.rank = rank;
    }
    //    public MenuMeta getMeta() {
//        return meta;
//    }
//
//    public void setMeta(MenuMeta meta) {
//        this.meta = meta;
//    }


    @Override
    public String toString() {
        return "JyMenu{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", url='" + url + '\'' +
                ", path='" + path + '\'' +
                ", component='" + component + '\'' +
                ", iconCls='" + iconCls + '\'' +
                ", keepAlive=" + keepAlive +
                ", requireAuth='" + requireAuth + '\'' +
                ", parentId=" + parentId +
                ", enabled=" + enabled +
                ", srcType=" + srcType +
                ", menuShow=" + menuShow +
                ", isChild=" + isChild +
                ", isEdit=" + isEdit +
                ", leaf=" + leaf +
                ", roles=" + roles +
                ", children=" + children +
                '}';
    }
}
